package com.taysear.parcel.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;

@Entity
public class Substation implements Serializable{

	private static final long serialVersionUID = 8765230111545473467L;

	@Id @Column(name="substation_id") @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer substationId;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="station_id")
	private Station station;
	private String code;
	private String name;
	@Column(name="substation_number")
	private Integer substationNumber;
	@Column(name="waybill_number")
	private Integer waybillNumber = 0;
	@NotNull @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="station_status")
	private StationStatus status; 
	
	public Integer getSubstationId() {
		return substationId;
	}
	public void setSubstationId(Integer substationId) {
		this.substationId = substationId;
	}
	public Station getStation() {
		return station;
	}
	public void setStation(Station station) {
		this.station = station;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSubstationNumber() {
		return substationNumber;
	}
	public void setSubstationNumber(Integer substationNumber) {
		this.substationNumber = substationNumber;
	}
	public Integer getWaybillNumber() {
		return waybillNumber;
	}
	public void setWaybillNumber(Integer waybillNumber) {
		this.waybillNumber = waybillNumber;
	}
	public StationStatus getStatus() {
		return status;
	}
	public void setStatus(StationStatus status) {
		this.status = status;
	}	
	@Override
    public String toString() {
        return code + " " + name;
    }
}
